
package stub.logicsvStub;

import po.CollegeConsularListPO;
import po.CollegeConsularPO;
import po.CollegeCoursePO;
import resultmessage.CollegeQueryRM;
import resultmessage.CourseQueryRM;
import vo.CollegeListVO;
import vo.CollegeMemberVO;
import logicsv.collegeQuery_logicsv.CollegeQueryLogicsv;
import logicsv.collegeQuery_logicsv.MemberType;

public class CollegeQueryLogicsvStub implements CollegeQueryLogicsv {
	CollegeListVO collegeListVO;
	CollegeMemberVO collegeMemberVO;
	CollegeCoursePO collegeCoursePO;
	CollegeConsularListPO collegeConsularListPO;
	
	public CollegeQueryLogicsvStub(CollegeListVO collegeListVO, CollegeMemberVO collegeMemberVO,
			CollegeCoursePO collegeCoursePO, CollegeConsularListPO collegeConsularListPO){
		collegeListVO = this.collegeListVO;
		collegeMemberVO = this.collegeMemberVO;
		collegeCoursePO = this.collegeCoursePO;
		collegeConsularListPO = this.collegeConsularListPO;
	}
	
	@Override
	public CollegeListVO getCollegeList() {
		// TODO Auto-generated method stub
		return collegeListVO;
	}

	@Override
	public CollegeMemberVO getCollege(String collegeID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeMemberVO.getCollegeID())){
			return collegeMemberVO;
		}
		return null;
	}

	@Override
	public CollegeQueryRM addMember(String collegeID, MemberType userType,
			String teacherID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeMemberVO.getCollegeID())
				&&userType.equals(collegeMemberVO.getMemberType())){
			return CollegeQueryRM.SUCCESS;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CollegeQueryRM deleteMember(String collegeID, MemberType userType,
			String teacherID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeMemberVO.getCollegeID())
				&&userType.equals(collegeMemberVO.getMemberType())){
			return CollegeQueryRM.SUCCESS;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CourseQueryRM addCourse(String collegeID, String courseID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeCoursePO.getCollegeID())){
			for(String c1:collegeCoursePO.courseIDList()){
				if(c1.equals(courseID)){
					return CourseQueryRM.COURSEID_EXIST;
				}
			}
			return CourseQueryRM.SUCCESS;
		}
		return CourseQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CourseQueryRM deleteCourse(String collegeID, String courseID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeCoursePO.getCollegeID())){
			for(String c1:collegeCoursePO.courseIDList()){
				if(c1.equals(courseID)){
					return CourseQueryRM.SUCCESS;
				}
			}
			return CourseQueryRM.COURSEID_NOT_EXIST;
		}
		return CourseQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CollegeQueryRM addCollegeConsular(String collegeID, String consularID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeConsularListPO.getCollegeID())){
			for(CollegeConsularPO c1:collegeConsularListPO.getCollegeConsularList()){
				if(c1.getCollegeID().equals(consularID)){
					return CollegeQueryRM.COLLEGECONSULAR_EXIT;
				}
			}
			return CollegeQueryRM.SUCCESS;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CollegeQueryRM deleteCollegeConsular(String collegeID, String consularID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeConsularListPO.getCollegeID())){
			for(CollegeConsularPO c1:collegeConsularListPO.getCollegeConsularList()){
				if(c1.getCollegeID().equals(consularID)){
					return CollegeQueryRM.SUCCESS;
				}
			}
			return CollegeQueryRM.COLLEGECONSULAR_NOT_EXIT;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

}

